home *** CD-ROM | disk | FTP | other *** search
- /* Test mit SetFunction()
-
- 28.10.94
- NewPatches !
- Now it is only drawn to the Screen which is set by GfxSetUpScreen(struct Screen *) !
- There are 3 Functions, which decide if the TIGA is active. The return value is true
- if the active Screen is on the TIGA :
-
- * GfxCheckBitMap(struct BitMap *bm); belongs the Bitmap to the Screen ?
-
- * GfxCheckRP(struct RastPort *rp); does the RastPort belong to the Screen ?
- well, windows have their own RastPort, use CheckBitMap(RP->BitMap) instead !
-
- * GfxCheckVP(struct ViewPort *vp); dito for ViewPorts !
- - does not matter , if SetRGBxx() sets the color everytime !
-
- See NewOpenScreenTags() for more information !
-
- Remark the BltBitMap()-Function. It shows, the Emulation is (relativly) stable now. I have
- to rework the BltBitMap() !
- Another bug is in the GfxDraw() function when using the Workbench lasso. Using it the first
- time works. Dragging the Lasso a second time immediately - the machine crashes. If I remove
- the clipping it works. If clicking on screen (all Icons are inactive) , clicking into a window
- and dragging the lasso again - allright works !
-
- 30.10.94 I added the PolyDraw() function but don't use it. PolyDraw() does use the OS Move()/Draw()
- command - and because of this PolyDraw() does work without patching ! The TIGA poly_line() could draw
- faster Polygons though - but mine is not 100% comptable and crashes some times - and for drawing
- pattern line polygons I use the GfxDraw() - code ! -> No speed increase !
-
- The Text() Function has to be rewritten. It is not necessary to patch graphic.library's
- Text(). It uses the BltTemplate() which extracts a 1 bit Mask to a destinatin bitmap.
- I have a similar working version in the EGS-Driver. I will implement it if I am not to lacy...
-
- Also I have a working MouseImage stuff in the EGS-Driver...should build it into the lib by times..
- */
-
- //#define DEBUG
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <dos.h>
- #include <intuition/intuitionbase.h>
-
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/graphics_pragmas.h>
- #include <pragmas/intuition_pragmas.h>
-
- #include "a2410_displayinfo.h"
- #include "gfx_pragmas.h"
- #include "graphics.h"
-
- #define REPLACE TRUE
-
- static LONG Busy = FALSE;
- struct Library *GfxBase=NULL,*DOSBase=NULL,*DiskfontBase;
- struct Library *GspGfxBase=NULL,*GraphicsBase=NULL;
- struct IntuitionBase *IntuitionBase=NULL;
-
- APTR Func_Mem;
- static BOOL Replace=FALSE,NoExit=FALSE,INSTALLED=FALSE;
-
- /* own Prototypes */
-
- void CloseTiga(int ExitCode);
- void RemovePatch(void);
- void InstallPatch(void);
-
- void __asm NewClearEOL(register __a1 struct RastPort *rp ); // -0x002a
- void (__asm *OldClearEOL)(register __a1 struct RastPort *rp ); // -0x002a
- void __asm NewClearScreen(register __a1 struct RastPort *rp ); // -0x0030
- void (__asm *OldClearScreen)(register __a1 struct RastPort *rp ); // -0x0030
-
- BOOL __asm NewClearRectRegion(register __a0 struct Region *region,register __a1 struct Rectangle *rectangle ); // -0x020a
- BOOL (__asm *OldClearRectRegion)(register __a0 struct Region *region,register __a1 struct Rectangle *rectangle ); // -0x020a
- void __asm NewClearRegion(register __a0 struct Region *region ); // -0x0210
- void (__asm *OldClearRegion)(register __a0 struct Region *region ); // -0x0210
-
-
- void __asm NewSetRast(register __a1 struct RastPort *rp,register __d0 unsigned long pen );
- void (__asm *OldSetRast)(register __a1 struct RastPort *rp,register __d0 unsigned long pen );
-
- void __asm NewMove(register __a1 struct RastPort *,register __d0 SHORT x,register __d1 SHORT y);
- void (__asm *OldMove)(register __a1 struct RastPort *,register __d0 SHORT x,register __d1 SHORT y);
- void __asm NewDraw(register __a1 struct RastPort *,register __d0 SHORT x,register __d1 SHORT y);
- void (__asm *OldDraw)(register __a1 struct RastPort *,register __d0 SHORT x,register __d1 SHORT y);
- void __asm NewRectFill(register __a1 struct RastPort *rp,register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax );
- void (__asm *OldRectFill)(register __a1 struct RastPort *rp,register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax );
- LONG __asm NewWritePixel(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- LONG (__asm *OldWritePixel)(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- void __asm NewDrawEllipse(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b );
- void (__asm *OldDrawEllipse)(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b );
- void __asm NewAreaEllipse(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b );
- void (__asm *OldAreaEllipse)(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b );
- LONG __asm NewText(register __a1 struct RastPort *rp,register __a0 STRPTR string,register __d0 unsigned long count );
- LONG (__asm *OldText)(register __a1 struct RastPort *rp,register __a0 STRPTR string,register __d0 unsigned long count );
- void __asm NewSetRGB4(register __a0 struct ViewPort *vp,register __d0 long index,register __d1 unsigned long red,
- register __d2 unsigned long green,register __d3 unsigned long blue );
- void (__asm *OldSetRGB4)(register __a0 struct ViewPort *vp,register __d0 long index,register __d1 unsigned long red,
- register __d2 unsigned long green,register __d3 unsigned long blue );
- void __asm NewSetRGB32(register __a0 struct ViewPort *vp,register __d0 long n,register __d1 unsigned long r,
- register __d2 unsigned long g,register __d3 unsigned long b);
- void (__asm *OldSetRGB32)(register __a0 struct ViewPort *vp,register __d0 long n,register __d1 unsigned long r,
- register __d2 unsigned long g,register __d3 unsigned long b);
- LONG __asm NewAreaMove(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- LONG (__asm *OldAreaMove)(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- LONG __asm NewAreaDraw(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- LONG (__asm *OldAreaDraw)(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y );
- LONG __asm NewAreaEnd(register __a1 struct RastPort *rp);
- LONG (__asm *OldAreaEnd)(register __a1 struct RastPort *rp);
- void __asm NewPolyDraw(register __a1 struct RastPort *rp,register __d0 long count,register __a0 WORD *polyTable );
- void (__asm *OldPolyDraw)(register __a1 struct RastPort *rp,register __d0 long count,register __a0 WORD *polyTable );
- LONG __asm NewSetFont(register __a1 struct RastPort *rp,register __a0 struct TextFont *textFont );
- LONG (__asm *OldSetFont)(register __a1 struct RastPort *rp,register __a0 struct TextFont *textFont );
- void __asm NewMoveSprite(register __a0 struct ViewPort vp,register __a1 struct SimpleSprite *sprite,register __d0 long x,register __d1 long y);
- void (__asm *OldMoveSprite)(register __a0 struct ViewPort vp,register __a1 struct SimpleSprite *sprite,register __d0 long x,register __d1 long y);
- LONG __asm NewBltBitMap(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct BitMap *destBitMap,
- register __d2 long xDest,register __d3 long yDest,register __d4 long xSize,
- register __d5 long ySize,register __d6 unsigned long minterm,register __d7 unsigned long mask,
- register __a2 PLANEPTR tempA );
- LONG (__asm *OldBltBitMap)(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct BitMap *destBitMap,
- register __d2 long xDest,register __d3 long yDest,register __d4 long xSize,
- register __d5 long ySize,register __d6 unsigned long minterm,register __d7 unsigned long mask,
- register __a2 PLANEPTR tempA );
-
- void __asm NewBltBitMapRastPort(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct RastPort *destRP,
- register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize,
- register __d6 unsigned long minterm );
- void (__asm *OldBltBitMapRastPort)(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct RastPort *destRP,
- register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize,
- register __d6 unsigned long minterm );
-
- void __asm NewBltTemplate(register __a0 PLANEPTR source,register __d0 long xSrc,register __d1 long srcMod,
- register __a1 struct RastPort *destRP,register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize );
- void (__asm *OldBltTemplate)(register __a0 PLANEPTR source,register __d0 long xSrc,register __d1 long srcMod,
- register __a1 struct RastPort *destRP,register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize );
-
- void __asm NewBltClear(register __a1 PLANEPTR memBlock,register __d0 unsigned long byteCount,
- register __d1 unsigned long flags );
- void (__asm *OldBltClear)(register __a1 PLANEPTR memBlock,register __d0 unsigned long byteCount,
- register __d1 unsigned long flags );
-
- void __asm NewBltPattern(register __a1 struct RastPort *rp,register __a0 PLANEPTR mask,
- register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax,register __d4 unsigned long maskBPR );
- void (__asm *OldBltPattern)(register __a1 struct RastPort *rp,register __a0 PLANEPTR mask,
- register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax,register __d4 unsigned long maskBPR );
-
- // Intuifunktionen :
-
- struct Screen *(__asm NewOpenScreenTagList)(register __a0 struct NewScreen *newScreen,register __a1 struct TagItem *tagList );
- LONG (__asm *OldOpenScreenTagList)(register __a0 struct NewScreen *newScreen,register __a1 struct TagItem *tagList );
- /*
- struct Screen *OpenScreenTags( struct NewScreen *newScreen,
- unsigned long tag1Type, ... );
- */
- BOOL __asm NewCloseScreen(register __a0 struct Screen *screen);
- BOOL (__asm *OldCloseScreen)(register __a0 struct Screen *screen);
-
- void main(int argc, char *argv[])
- {
- /* 800x600 : MODE_800x600_NI
- 1024x768 : MODE_1024x768_NI , BOARD0_OSC2=67.667MHZ
- 1024x1024 : MODE_1024x1024_NI , 80.00MHZ
- */
- UBYTE *Command0 = "c:loadtiga "\
- "BOARD0_MODE=MODE_800x600_NI "\
- "BOARD0_OSC1=36.000MHZ "\
- "BOARD0_OSC2=67.667MHZ "\
- "SETUP=FFB62460 "\
- " >NIL:";
-
- // SystemTags("avail flush >nil:",TAG_DONE);
- // if (SystemTags(Command0,TAG_DONE)) CloseTiga(20); // couldn't load the tiga !
-
- if (!(GfxBase=(struct Library *)OpenLibrary("graphics.library",36L))) CloseTiga(10);
- if (!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",36L))) CloseTiga(10);
- if (!(GraphicsBase=(struct Library *)OpenLibrary("gfx.library",0l))) CloseTiga(10);
-
- if ((argc==2)&&(!strncmp(argv[1],"n",1))) NoExit = TRUE;
- if (argc==0) NoExit = FALSE;
-
- Delay(30);
- GfxClearScreen(NULL);
-
- GfxSetUpScreen(IntuitionBase->ActiveScreen);
- Forbid();
- InstallPatch();
- Permit();
-
- INSTALLED = TRUE;
-
- puts("A2410 TIGA driver");
- puts("(c)1994 jürgen schober");
- puts("functions patched ...");
-
- printf("press <Enter> to remove patches ");
- getchar();
-
- CloseTiga(0);
- }/*main*/
-
- void CloseTiga(int code)
- {
- if (INSTALLED)
- {
- Forbid();
- RemovePatch();
- Permit();
- puts("\npatches removed ...");
- }
-
- if (IntuitionBase) CloseLibrary((struct Library*)IntuitionBase);
- if (GfxBase) CloseLibrary(GfxBase);
- if (GraphicsBase) CloseLibrary(GraphicsBase);
- exit(code);
- }
-
- void RemovePatch(void)
- {
- /* Graphics primitives : */
-
- // SetFunction(GfxBase,-0x00ea,(APTR)OldSetRast); // gfx SetRast() function
- SetFunction(GfxBase,-0x0144,(APTR)OldWritePixel); // gfx WritePixel() function
- SetFunction(GfxBase,-0x00F6,(APTR)OldDraw); // gfx Move() function
- SetFunction(GfxBase,-0x0132,(APTR)OldRectFill); // gfx RectFill() function
-
- SetFunction(GfxBase,-0x00B4,(APTR)OldDrawEllipse); // gfx DrawEllipse() function
- SetFunction(GfxBase,-0x00BA,(APTR)OldAreaEllipse); // gfx AreaEllipse() function
-
- SetFunction(GfxBase,-0x0120,(APTR)OldSetRGB4); // gfx SetRGB4() function
- SetFunction(GfxBase,-0x0354,(APTR)OldSetRGB32); // gfx SetRGB32() function
-
- /* Text Functions : */
-
- SetFunction(GfxBase,-0x003C,(APTR)OldText); // gfx Text() function
- SetFunction(GfxBase,-0x0042,(APTR)OldSetFont); // gfx SetFont()
-
- /* BitMap Functions : */
-
- SetFunction(GfxBase,-0x001E,(APTR)OldBltBitMap); // gfx BltBitMap() function
- /*
- SetFunction(GfxBase,-0x0024,(APTR)OldBltTemplate);
- SetFunction(GfxBase,-0x012c,(APTR)OldBltClear);
- SetFunction(GfxBase,-0x0138,(APTR)OldBltPattern);
- */
- SetFunction(GfxBase,-0x0108,(APTR)OldAreaEnd); // gfx AreaEnd() function
-
- // SetFunction(GfxBase,-0x01aa,(APTR)OldMoveSprite); //
- /* ----------------------------------------------------------------------
- Disabled Functions :
-
- SetFunction(GfxBase,-0x002a,(APTR)OldClearEOL);
- SetFunction(GfxBase,-0x0030,(APTR)OldClearScreen);
-
- SetFunction(GfxBase,-0x020a,(APTR)OldClearRectRegion);
- SetFunction(GfxBase,-0x0210,(APTR)OldClearRegion);
-
- *** Never Patched Functions : ***
-
- ** GfxMove 100% kompatibel zu Move() -> patch disabled **
-
- SetFunction(GfxBase, -0xF0,(APTR)OldMove);
-
- ** BlitBitmapRastPort() ruft BltBitMap() auf **
-
- SetFunction(GfxBase,-0x025e,(APTR)OldBltBitMapRastPort);
-
- SetFunction(GfxBase,-0x0150,(APTR)OldPolyDraw); // gfx PolyDraw() function
- SetFunction(GfxBase,-0x00FC,(APTR)OldAreaMove); // gfx AreaMove() function
- SetFunction(GfxBase,-0x0102,(APTR)OldAreaDraw); // gfx AreaDraw() function
- */
-
- /* Some Intuition functions : */
-
- SetFunction((struct Library *)IntuitionBase,-0x0264,(APTR)OldOpenScreenTagList);
- // SetFunction((struct Library *)IntuitionBase,-0x0042,(APTR)OldCloseScreen);
- }
-
- void InstallPatch(void)
- {
- /* Graphics primitives : */
-
- // OldSetRast = (APTR)SetFunction(GfxBase,-0x00ea,(APTR)NewSetRast);
- OldWritePixel = (APTR)SetFunction(GfxBase,-0x0144,(APTR)NewWritePixel); // gfx WritePixel() function
- OldDraw = (APTR)SetFunction(GfxBase,-0x00F6,(APTR)NewDraw); // gfx Move() function
- OldRectFill = (APTR)SetFunction(GfxBase,-0x0132,(APTR)NewRectFill); // gfx RectFilll() function
-
- OldDrawEllipse= (APTR)SetFunction(GfxBase,-0x00B4,(APTR)NewDrawEllipse); // gfx DrawEllipse() function
- OldAreaEllipse= (APTR)SetFunction(GfxBase,-0x00BA,(APTR)NewAreaEllipse); // gfx AreaEllipse() function
-
- OldSetRGB4 = (APTR)SetFunction(GfxBase,-0x0120,(APTR)NewSetRGB4); // gfx SetRGB4() function
- OldSetRGB32 = (APTR)SetFunction(GfxBase,-0x0354,(APTR)NewSetRGB32); // gfx SetRGB32() function
-
- /* Text Functions : */
-
- OldText = (APTR)SetFunction(GfxBase,-0x003C,(APTR)NewText); // gfx Text() function
- OldSetFont = (APTR)SetFunction(GfxBase,-0x0042,(APTR)NewSetFont); // gfx SetFont()
-
- /* BitMap Functions : */
-
- OldBltBitMap = (APTR)SetFunction(GfxBase,-0x001E,(APTR)NewBltBitMap); // gfx BltBitMap() function
- /*
- OldBltTemplate= (APTR)SetFunction(GfxBase,-0x0024,(APTR)NewBltTemplate);
- OldBltClear = (APTR)SetFunction(GfxBase,-0x012c,(APTR)NewBltClear);
- OldBltPattern = (APTR)SetFunction(GfxBase,-0x0138,(APTR)NewBltPattern);
- */
- OldAreaEnd = (APTR)SetFunction(GfxBase,-0x0108,(APTR)NewAreaEnd); // gfx AreaEnd() function
-
- // OldMoveSprite = (APTR)SetFunction(GfxBase,-0x01aa,(APTR)NewMoveSprite);
- /* ----------------------------------------------------------------------
- Disabled Functions :
-
- OldClearEOL = (APTR)SetFunction(GfxBase,-0x002a,(APTR)NewClearEOL);
- OldClearScreen= (APTR)SetFunction(GfxBase,-0x0030,(APTR)NewClearScreen);
-
- OldClearRectRegion = (APTR)SetFunction(GfxBase,-0x020a,(APTR)NewClearRectRegion);
- OldClearRegion = (APTR)SetFunction(GfxBase,-0x0210,(APTR)NewClearRegion);
-
- *** Never Patched Functions : ***
-
- ** GfxMove() 100% kompatibel zu Move() -> patch disabled ! **
-
- OldMove = (APTR)SetFunction(GfxBase,-0x00F0,(APTR)NewMove);
-
- ** BlitBitmapRastPort() ruft BltBitMap() auf **
-
- OldBltBitMapRastPort = (APTR)SetFunction(GfxBase,-0x025e,(APTR)NewBltBitMapRastPort);
-
- OldPolyDraw = (APTR)SetFunction(GfxBase,-0x0150,(APTR)NewPolyDraw); // gfx PolyDraw() function
- OldAreaMove = (APTR)SetFunction(GfxBase,-0x00FC,(APTR)NewAreaMove); // gfx AreaMove() function
- OldAreaDraw = (APTR)SetFunction(GfxBase,-0x0102,(APTR)NewAreaDraw); // gfx AreaDraw() function
-
- */
-
- /* Some Intiuion functions : */
-
- OldOpenScreenTagList = (APTR)SetFunction((struct Library *)IntuitionBase,-0x0264,(APTR)NewOpenScreenTagList);
- // OldCloseScreen = (APTR)SetFunction((struct Library *)IntuitionBase,-0x0042,(APTR)NewCloseScreen);
- }
-
-
- /* ---------------------------------------------------------*/
-
- /* NEUE FUNKTIONEN */
-
- /* ---------------------------------------------------------*/
-
- BOOL __asm NewClearRectRegion(register __a0 struct Region *region,register __a1 struct Rectangle *rectangle )
- {
- return(TRUE);
- }
-
- void __asm NewClearRegion(register __a0 struct Region *region )
- {
- }
-
- void __asm NewClearEOL(register __a1 struct RastPort *rp ) // -0x002a
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldClearEOL(rp);
- }
-
- void __asm NewClearScreen(register __a1 struct RastPort *rp ) // -0x0030
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldClearScreen(rp);
- }
-
- void __asm NewSetRast(register __a1 struct RastPort *rp,register __d0 unsigned long pen )
- {
- if (GfxCheckBitMap(rp->BitMap))
- GfxSetRast(rp,pen);
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldSetRast(rp,pen); // original function
- }
- }
-
- /* graphics Move() */
- void __asm NewMove(register __a1 struct RastPort * rp,register __d0 SHORT x,register __d1 SHORT y)
- {
- OldMove(rp,x,y);
- //GfxMove(rp,x,y); // New own function - 100% ident mit Move !
- }
-
- /* graphics Draw() */
- void __asm NewDraw(register __a1 struct RastPort * rp,register __d0 SHORT x,register __d1 SHORT y)
- {
- if (GfxCheckBitMap(rp->BitMap))
- GfxDraw(rp,x,y); // New own function
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldDraw(rp,x,y); // original function
- }
- }
-
- void __asm NewRectFill(register __a1 struct RastPort *rp,register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax )
- {
- if (GfxCheckBitMap(rp->BitMap))
- GfxRectFill(rp,xMin,yMin,xMax,yMax); // New own function
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldRectFill(rp,xMin,yMin,xMax,yMax); // original function
- }
- }
-
- LONG __asm NewWritePixel(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y )
- {
- if (GfxCheckBitMap(rp->BitMap))
- GfxWritePixel(rp,x,y); // New own function
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- return(OldWritePixel(rp,x,y)); // original function
- }
- }
-
- void __asm NewDrawEllipse(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b)
- {
- GfxDrawEllipse(rp,xCenter,yCenter,a,b); // New own function
- putreg(REG_A6,(LONG)GfxBase);
- OldDrawEllipse(rp,xCenter,yCenter,a,b); // original function
- /*
- if (GfxCheckBitMap(rp->BitMap))
- GfxDrawEllipse(rp,xCenter,yCenter,a,b); // New own function
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldDrawEllipse(rp,xCenter,yCenter,a,b); // original function
- }
- */
- }
-
- void __asm NewAreaEllipse(register __a1 struct RastPort *rp,register __d0 long xCenter,
- register __d1 long yCenter,register __d2 long a,register __d3 long b)
- {
- GfxAreaEllipse(rp,xCenter,yCenter,a,b); // New own function
- putreg(REG_A6,(LONG)GfxBase);
- OldAreaEllipse(rp,xCenter,yCenter,a,b); // original function
- /*
- if (GfxCheckBitMap(rp->BitMap))
- GfxAreaEllipse(rp,xCenter,yCenter,a,b); // New own function
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldAreaEllipse(rp,xCenter,yCenter,a,b); // original function
- }
- */
- }
-
- LONG __asm NewText(register __a1 struct RastPort *rp,register __a0 STRPTR string,register __d0 unsigned long count )
- {
- if (GfxCheckBitMap(rp->BitMap))
- return(GfxText(rp,string,count));
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- return(OldText(rp,string,count)); // original function
- }
- }
-
- LONG __asm NewSetFont(register __a1 struct RastPort *rp,register __a0 struct TextFont *textFont )
- {
- return(GfxSetFont(rp,textFont));
-
- /*
- if (GfxCheckRP(rp))
- {
- GfxSetFont(rp,textFont);
- }
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- return((LONG)OldSetFont(rp,textFont));
- }
- */
- }
-
- void __asm NewSetRGB4(register __a0 struct ViewPort *vp,register __d0 long index,register __d1 unsigned long red,
- register __d2 unsigned long green,register __d3 unsigned long blue )
- {
- if (GfxCheckVP(vp))
- GfxSetRGB4(vp,index,red,green,blue);
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldSetRGB4(vp,index,red,green,blue);
- }
- }
-
- void __asm NewSetRGB32(register __a0 struct ViewPort *vp,register __d0 long n,register __d1 unsigned long r,
- register __d2 unsigned long g,register __d3 unsigned long b)
- {
- if (GfxCheckVP(vp))
- GfxSetRGB32(vp,n,r,g,b);
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldSetRGB32(vp,n,r,g,b);
- }
- }
-
- void __asm NewPolyDraw(register __a1 struct RastPort *rp,register __d0 long count,register __a0 WORD *polyTable )
- {
- if (GfxCheckBitMap(rp->BitMap))
- GfxPolyDraw(rp,count,polyTable);
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- PolyDraw(rp,count,polyTable);
- }
- }
-
- LONG __asm NewAreaMove(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y)
- {
- /*
- if (GfxCheckBitMap(rp->BitMap))
- return(GfxAreaMove(rp,x,y));
- else
-
- {
- putreg(REG_A6,(LONG)GfxBase);
- return((LONG)OldAreaMove(rp,x,y));
- }
- */
- return(0);
- }
-
- LONG __asm NewAreaDraw(register __a1 struct RastPort *rp,register __d0 long x,register __d1 long y)
- {
- /*
- if (GfxCheckBitMap(rp->BitMap))
- return(GfxAreaDraw(rp,x,y));
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- return((LONG)OldAreaDraw(rp,x,y));
- }
- */
- return(0);
- }
-
- LONG __asm NewAreaEnd(register __a1 struct RastPort *rp)
- {
- if (GfxCheckBitMap(rp->BitMap))
- return(GfxAreaEnd(rp));
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- return((LONG)OldAreaEnd(rp));
- }
- }
-
- LONG __asm NewBltBitMap(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct BitMap *destBitMap,
- register __d2 long xDest,register __d3 long yDest,register __d4 long xSize,
- register __d5 long ySize,register __d6 unsigned long minterm,register __d7 unsigned long mask,
- register __a2 PLANEPTR tempA )
- {
-
- if (GfxCheckBitMap(destBitMap)||GfxCheckBitMap(destBitMap))
- return(GfxBltBitMap(srcBitMap,xSrc,ySrc,destBitMap,xDest,yDest,xSize,ySize,minterm,mask,tempA));
- else
- {
- // Flush Bitmap :
- GfxBltBitMap(srcBitMap,xSrc,ySrc,destBitMap,xDest,yDest,xSize,ySize,minterm,mask,tempA);
-
- putreg(REG_A6,(LONG)GfxBase);
- return((OldBltBitMap(srcBitMap,xSrc,ySrc,destBitMap,xDest,yDest,xSize,ySize,minterm,mask,tempA)));
- }
- }
-
- void __asm NewBltBitMapRastPort(register __a0 struct BitMap *srcBitMap,
- register __d0 long xSrc,register __d1 long ySrc,
- register __a1 struct RastPort *destRP,
- register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize,
- register __d6 unsigned long minterm )
- {
- // GfxBltBitMap(srcBitMap,xSrc,ySrc,destRP->BitMap,xDest,yDest,xSize,ySize,minterm,0xff,NULL);
- }
-
- void __asm NewBltTemplate(register __a0 PLANEPTR source,register __d0 long xSrc,register __d1 long srcMod,
- register __a1 struct RastPort *destRP,register __d2 long xDest,register __d3 long yDest,
- register __d4 long xSize,register __d5 long ySize )
- {
- /*
- putreg(REG_A6,(LONG)GfxBase);
- OldBltTemplate(source,xSrc,srcMod,destRP,xDest,yDest,xSize,ySize);
- */
- }
-
- void __asm NewBltClear(register __a1 PLANEPTR memBlock,register __d0 unsigned long byteCount,
- register __d1 unsigned long flags )
- {
- register i;
- UBYTE *mem;
- /*
- mem = (UBYTE*)memBlock;
- for (i = 0; i< byteCount; i++)
- mem[i] = 0;
-
- putreg(REG_A6,(LONG)GfxBase);
- OldBltClear(memBlock,byteCount,flags);
- */
- }
-
- void __asm NewBltPattern(register __a1 struct RastPort *rp,register __a0 PLANEPTR mask,
- register __d0 long xMin,register __d1 long yMin,
- register __d2 long xMax,register __d3 long yMax,register __d4 unsigned long maskBPR )
- {
- putreg(REG_A6,(LONG)GfxBase);
- // OldBltPattern(rp,mask,xMin,yMin,xMax,yMax,maskBPR);
- }
-
- void __asm NewMoveSprite(register __a0 struct ViewPort vp,register __a1 struct SimpleSprite *sprite,register __d0 long x,register __d1 long y)
- {
- if (GfxCheckVP(vp))
- GfxPointerXY(NULL,x,y);
- else
- {
- putreg(REG_A6,(LONG)GfxBase);
- OldMoveSprite(vp,sprite,x,y);
- }
- }
-
- /* ------------------------------*
- * Intui functions : *
- * ------------------------------*/
-
-
- struct Screen *(__asm NewOpenScreenTagList)(register __a0 struct NewScreen *newScreen,
- register __a1 struct TagItem *tagList )
- {
- /*
- this patch does not work ! I do not know why. But it should work this way.
- Although if I only call OldOpenScreenTagList(newScreen,tagList) - the machine crashes (?)
-
- Well, look in the while loop. It shows how the display_ID is parsed and what is done if
- the TIGA_ID is found ! I open a standard Amiga Screen now. Well I can use a 4 BitPlane
- and correct it up to 8 Planes after opening the screen - I just use it for the functions
- OpenScreen() uses. The RastPort does always use 8 Bit depth (eg. RP->FgPen = 8 Bit !)
- What is not done now is copying the tags from the calling programm to the OpenScreen() -
- it will be done in the next version. I used "patch_tags" (see below) for testing.
- I used also a LowRes - Screen to get more then 16 Colors. But then I have strange looking
- Systemgadgets ! I would be happy, if you would find out, why the patch does not work. :-(
-
- Allright. That's where you can hook into. Hope it works !
- */
- /*
-
- struct TagItem *tags;
- ULONG TIGA_ID = 0L;
- struct Screen *sc;
- struct TagItem patch_tags[] = {
- SA_Width,800,
- SA_Height,600,
- SA_Depth,4,
- TAG_DONE,TAG_DONE
- };
-
- tags = tagList;
- while ((tags->ti_Tag!=TAG_DONE)&&(tags->ti_Data!=TAG_DONE))
- {
- switch (tags->ti_Tag)
- {
- case SA_DisplayID :
- {
- // That's what should be parsed, when a TIGA_ID is working !
- // if ((tags->ti_Data & A2410_MONITOR_ID) == A2410_MONITOR_ID)
- if ((tags->ti_Data & (NTSC_MONITOR_ID|PAL_MONITOR_ID|LORES_KEY)))
- {
- // TIGA_ID = tags->ti_Data;
- // Here, the Mode should be parsed ...
-
- putreg(REG_A6,(LONG)IntuitionBase);
- if (sc = (struct Screen *)(OldOpenScreenTagList(newScreen,(struct TagItem *)patch_tags)))
- {
- GfxSetUpScreen(sc);
- return((long)sc);
- }
- }
- return(0);
- break;
- }
- default : break;
- }
- tags++;
- }
- */
- putreg(REG_A6,(LONG)IntuitionBase);
- return((struct Screen *)OldOpenScreenTagList(newScreen,tagList));
- }
-
- BOOL __asm NewCloseScreen(register __a0 struct Screen *screen )
- {
- /*
- GfxRemoveScreen(screen);
- return(//GfxCloseScreen(screen));
- */
- putreg(REG_A6,(LONG)IntuitionBase);
- return(NewCloseScreen(screen));
-
- }
-
- /*
- MouseImage()
- */